<?php
    use yii\helpers\Html;
    use yii\bootstrap\ActiveForm;
    use app\modules\core\models\FieldForm;

    $form = ActiveForm::begin([
        'id'        => 'field-form',
        'layout' => 'horizontal',
        'method'    => 'post',
        'fieldConfig' => [
            'template' => '{label}<div class="col-lg-5">{input}</div><div class="col-lg-4">{error}</div>',
            'labelOptions' => ['class' => 'col-lg-3 control-label'],
        ],
    ]);

    
    $model = new FieldForm();

    echo $form->field($model, 'name')->textInput(['autofocus' => true])->label('名称');

    echo $form->field($model, 'type')->dropDownList(FieldForm::$fieldTypes)->label('类型');

    echo $form->field($model, 'view')->dropDownList(FieldForm::$viewList)->label('视图');

    echo $form->field($model, 'group')->textInput()->label('分组');

    echo $form->field($model, 'sort')->textInput()->label('排序');

    echo $form->field($model, 'required')->checkBox(['1' => '必需'])->label('是否必需');

    echo $form->field($model, 'sourceType')->dropDownList(FieldForm::$stypes)->label('数据源类型');

    echo $form->field($model, 'source')->textInput()->label('数据源');

    // echo $form->field($model, 'validates')->dropDownList()->lable('验证器');

?>
        <div class="form-group">
            <div class="col-lg-offset-5 col-lg-12">
                <?php echo Html::submitButton('提交', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
            </div>
        </div>
<?php ActiveForm::end(); ?>

